package com.lgy.service;

import com.lgy.beans.ProductInfo;
import com.lgy.dto.CartDTO;
import com.lgy.exception.SellException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

public interface ProductService {
    ProductInfo findOne(String productId) throws SellException;

    /**
     * 查询上架的商品
     * @return
     */
    List<ProductInfo> findUpAll() throws SellException;

    Page<ProductInfo> findAll(Pageable pageable) throws SellException;

    ProductInfo save(ProductInfo productInfo) throws SellException;

    /**
     * 加库存
     * @param carDTOList
     */
    void increaseStock(List<CartDTO> carDTOList) throws SellException;

    /**
     * 减库存
     * @param carDTOList
     */
    void decreaseStock(List<CartDTO> carDTOList) throws SellException;

    /**
     * 上架
     * @param productId
     * @return
     */
    ProductInfo onSale(String productId) throws SellException;

    /**
     * 下架
     * @param productId
     * @return
     */
    ProductInfo offSale(String productId) throws SellException;
}
